import { Component } from "react"

export default class Com2_emit2 extends Component {
  constructor(props) {
    super(props)
  }

  onAdd(n) {
    this.props.onAdd(n)
  }

  render() {
    return (
      <div>
        <button
          onClick={() => {
            this.onAdd(1)
          }}
        >
          +1
        </button>
        <button
          onClick={() => {
            this.onAdd(2)
          }}
        >
          +2
        </button>
      </div>
    )
  }
}
